int fn(int a, int n) {
    int result = 0;
    for (int i = 0; i < n; i++) {
        result = result * 10 + a;
    }
    return result;
}

int SumA(int a, int n) {
    int sum = 0;
    int term = 0;
    for (int i = 0; i < n; i++) {
        term = term * 10 + a; 
        sum += term;         
    }
    return sum;
}
